<?php

namespace app\api\controller\supplier;

use app\api\base\RestfulBase;
use app\modules\supplier\logic\FinReportLogic;
Class FinReport extends RestfulBase
{

    protected $logic;
    protected function _initialize()
    {
        $this->logic = new FinReportLogic($this->request->param());
    }

    public function index(){
        if($this->request->isGet()){
             $data = $this->logic->index();
             if (is_array($data)){
                 return $this->apiSuccess($data);
             }else{
                 return $this->apiError($this->logic->getError());
             }
        }else{
           return  $this->apiError('无效请求！');
        }
    }

    public function goods_sale(){
        if ($this->request->isGet()){
            $data = $this->logic->goodsSale();
            if (is_array($data)){
                return $this->apiSuccess($data);
            }else{
                return $this->apiError($this->logic->getError());
            }

        }else{
            return $this->apiError('无效请求！');
        }
    }

    public function supplier_price(){
        if ($this->request->isGet()){
            $data = $this->logic->supplierPrice();
            if (is_array($data)){
                return $this->apiSuccess($data);
            }else{
                return $this->apiError($this->logic->getError());
            }
        }else{
            return $this->apiError('无效请求！');
        }
    }

}

